SetPanel={};
local this = SetPanel;


function SetPanel.New()
    panelMgr:CreatePanel("Set",nil); 
   
end

function SetPanel.OnCreate(go)   
    
end

function SetPanel.OnBack()
 LoginPanel.New();
 panelMgr:ClosePanel('Set');  
end

function SetPanel.Awake(go)
    log("SetPanel.Awake");
    this.gameObject=go;
    this.transform=go.transform;
    local behavior = this.transform:GetComponent('LuaBehaviour');
    
    this.slider=this.transform:Find("Slider").gameObject;
    behavior:AddSlider(this.slider,this.OnSliderChange);
    this.text=this.transform:Find("Text").gameObject;
    this.logo=this.transform:Find("Logo"):GetComponent('Image');
    this.backBtn=this.transform:Find("backBtn").gameObject;
    behavior:AddClick(this.backBtn,this.OnBack);
 
end

function SetPanel.Start()
    log("SetPanel.Start");

    -- local sp = resMgr:LoadAsset('qiku_asset',"Character",typeof(Sprite));
    -- this.image.sprite=sp;

 
    --Dotween
    -- this.image.transform:DOKill(false);
    -- this.image.transform:DORotate(Vector3(0,0,180),2,
    -- DG.Tweening.RotateMode.Fast):
    -- SetLoops(-1,DG.Tweening.LoopType.Incremental);

    -- --先停后开协程,防止多次开启
    -- coroutine.start(this.coro);
    -- this.coro=coroutine.start(this.TestUpdate);

    --开启Lua的Update
    -- UpdateBeat:Remove(this.Update);
    -- UpdateBeat:Add(this.Update);
end
--协程方式
-- function SetPanel.TestUpdate()
--     while true do
--         coroutine.step();
--         this.image.transform:Rotate(Vector3.forward,20);
--     end
-- end

--Update 方式
-- function  SetPanel.Update()
--     this.image.transform:Rotate(Vector3.forward,20);
-- end

--系统生命周期的OnDestroy
-- function SetPanel.OnDestroy()
--     UpdateBeat:Remove(this.Update);
--     coroutine.stop(this.coro);
-- end